package com.atguigu.ssyx.common.exception;

import com.atguigu.ssyx.common.result.ResultCodeEnum;
import lombok.Data;

/**
 * Created on 2023/6/26
 * 自定义异常处理类
 */
@Data
public class SsyxException extends RuntimeException{

    //返回状态码
    private Integer code;

    //构造函数，处理系统运行时异常
    public SsyxException(Integer code,String message){
        super(message);//继承RuntimeException异常
        this.code = code;
    }

    //构造函数，处理自定义异常
    public SsyxException(Integer code, ResultCodeEnum resultCodeEnum){
        super(resultCodeEnum.getMessage());
        this.code = resultCodeEnum.getCode();
    }
}
